package com.legoo.studaychineseonline.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.Gravity;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.legoo.studaychineseonline.R;
import com.legoo.studaychineseonline.base.BaseActivity;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class ChooseClassTypeActivity extends BaseActivity {
    @BindView(R.id.tv_title_left)
    TextView tvTitleLeft;
    @BindView(R.id.tv_title)
    TextView tvTitle;
    @BindView(R.id.tv_title_right)
    TextView tvTitleRight;
    @BindView(R.id.tv1)
    TextView tv1;
    @BindView(R.id.rl_sijiao)
    RelativeLayout rlSijiao;
    @BindView(R.id.tv2)
    TextView tv2;
    @BindView(R.id.rl_xiaoban)
    RelativeLayout rlXiaoban;
    String classType ="";//私教: 1; 小班: 2;
    private String where;

    @Override
    protected void myOnCreate(@Nullable Bundle savedInstanceState) {
        ButterKnife.bind(this);
        Intent intent = getIntent();
        where = intent.getStringExtra("where");
        tvTitle.setText("选择课程类型");
        tvTitleLeft.setBackgroundResource(R.mipmap.img_fanhui);
    }

    @Override
    protected void initData() {
        LinearLayout.LayoutParams linearParams =(LinearLayout.LayoutParams) tvTitleRight.getLayoutParams();
        linearParams.height = LinearLayout.LayoutParams.MATCH_PARENT;
        linearParams.width = LinearLayout.LayoutParams.WRAP_CONTENT;
        tvTitleRight.setLayoutParams(linearParams);
        tvTitleRight.setBackgroundResource(0);
        tvTitleRight.setGravity(Gravity.CENTER);
        tvTitleRight.setText("下一步");
    }

    @Override
    protected void resolveBundle(Bundle bundle) {

    }

    @Override
    protected int myLayoutId() {
        return R.layout.activity_choose_type;
    }


    @OnClick({R.id.tv_title_left, R.id.tv_title_right, R.id.rl_sijiao, R.id.rl_xiaoban})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.tv_title_left:
                finish();
                break;
            case R.id.tv_title_right:
                if ("".equals(classType)){
                    showToast("请选择课程类型");
                    return;
                }
                Intent intent = new Intent(context,ChooseClassContentActivity.class);
                intent.putExtra("classType",classType);
                intent.putExtra("where",where);
                startActivity(intent);

                break;
            case R.id.rl_sijiao:
                classType = "sijiao";
                rlXiaoban.setAlpha(1.0f);
                rlSijiao.setAlpha(0.7f);

                break;
            case R.id.rl_xiaoban:
                classType = "xiaoban";
                rlSijiao.setAlpha(1.0f);
                rlXiaoban.setAlpha(0.7f);
                break;
                default:
        }
    }
}
